home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1128 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.7 KB  |  62 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Kind of Annoying
  5. Date: 17 Apr 1996 14:57:36 GMT
  6. Organization: Comp Sci, University of Melbourne
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4l2et2$rik@mulga.cs.mu.OZ.AU>
  9. References: <4kjpfq$r3k@news2.cais.com>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. X-Nntp-Posting-Host: mundook.cs.mu.oz.au
  12. Content-Length: 824
  13. X-Lines: 39
  14. Originator: clamage@taumet
  15.  
  16. jah@cais.cais.com (John A Hughes) writes:
  17.  
  18. >The following doesn't compile, because the calls to foo look ambiguous
  19. >to the compiler:
  20. >
  21. >template<class T>
  22. >class Goo {
  23. >public:
  24. >    void foo(T *) {}
  25. >};
  26. [...]
  27. >class C : public Goo<A>, public Goo<B> {
  28.  
  29. I believe that if you add
  30.  
  31.     public:
  32.         using Goo<A>::foo;
  33.         using Goo<B>::foo;
  34.  
  35. here in the declaration of class C, this will resolve the ambiguities
  36. in the calls below:
  37.  
  38. >};
  39. >
  40. >main() {
  41. >    A a;
  42. >    B b;
  43. >    C c;
  44. >    c.foo(&a);
  45. >    c.foo(&b);
  46. >}
  47.  
  48. Unfortunately, however, none of the C++ compilers that I have access
  49. to support this yet.
  50.  
  51. --
  52. Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
  53. WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
  54. PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
  55.  
  56.  
  57. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  58. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  59. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  60. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  61. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  62.